from django.db import models
from tagging.fields import TagField
import mptt
import fts
# Create your models here.

class Category(models.Model):
    name = models.CharField(max_length=50)
    parent = models.ForeignKey('self', null=True, blank=True, related_name='children')

    def __unicode__(self):
        return u"%s" % self.name

    class Meta:
        verbose_name_plural = 'categories'

mptt.register(Category, order_insertion_by=['name'])

class Product(fts.SearchableModel):
    name = models.CharField(max_length=128)
    category = models.ForeignKey(Category)
    tags = TagField()


